package fatecpg.com.br.japassei.bd;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by MarcoAurélio on 28/11/2014.
 */
public class MySQLiteHelper extends SQLiteOpenHelper{

        // Database Version
        private static final int DATABASE_VERSION = 1;
        // Database Name
        private static final String DATABASE_NAME = "bd_japassei";

        public MySQLiteHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            String CREATE_DISCIP_TABLE = "CREATE TABLE tb_disciplinas (" +
                    "  cd_disciplina INTEGER PRIMARY KEY AUTOINCREMENT," +
                    "  nm_disciplina VARCHAR(20) NOT NULL," +
                    "  ds_disciplina VARCHAR(30)," +
                    "  qt_prova_um FLOAT(4)," +
                    "  qt_prova_dois FLOAT(4)," +
                    "  qt_trab_prat FLOAT(4)" +
                    "  );";
            db.execSQL(CREATE_DISCIP_TABLE);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            db.execSQL("DROP TABLE IF EXISTS tb_disciplinas");
            this.onCreate(db);
        }
    }